<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      html,
      body,
      div {
        width: 100%;
      }
      img {
        width: 100%;
      }
    </style>
  </head>
  <body>
    <input type="text" /><button onclick="serachFn()">搜索</button>
    <div></div>
  </body>
  <script type="module">
    import axios from "../day11/axios.js";
    const http = axios.create({
      baseURL: "https://v.api.aa1.cn/api/api-meiribizhi/",
      //   baseURL: "https://www.buquwu.com/api/search.php",
      "content-type": "application/json",
    });
    window.serachFn = function () {
      let novel_name = document.querySelector("input").value;
      let HTML = "";
      http
        .request({
          url: "api.php",
          method: "get",
          params: {
            // nama: novel_name,
          },
        })
        .then((res) => {
          console.log(res);
          res.data.data.forEach((v) => {
            HTML += `
                <img src="${v.url}" />
                `;
          });
          document.querySelector("div").innerHTML = HTML;
        });
    };
  </script>
</html>
